﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace _4T.Data
{
    public class PersonalInfo
    {
        private string m_PersonalCode;
        private string m_Username;
        private string m_FullName;
        private string m_PhoneNumber;
        private string m_Email;
        private int m_Role;
        public string PersonalCode
        {
            get { return m_PersonalCode; }
            set { m_PersonalCode = value; }
        }

        public string Username
        {
            get { return m_Username; }
            set { m_Username = value; }
        }

        public string FullName
        {
            get { return m_FullName; }
            set { m_FullName = value; }
        }

        public string PhoneNumber
        {
            get { return m_PhoneNumber; }
            set { m_PhoneNumber = value; }
        }

        public string Email
        {
            get { return m_Email; }
            set { m_Email = value; }
        }

        public int Role
        {
            get { return m_Role; }
            set { m_Role = value; }
        }

        public PersonalInfo() { }

        public PersonalInfo(string personalCode, string username, string fullName, string phoneNumber, string email, int role)
        {
            PersonalCode = personalCode;
            Username = username;
            FullName = fullName;
            PhoneNumber = phoneNumber;
            Email = email;
            Role = role;
        }

        public PersonalInfo(string personalCode, string username, string fullName, string phoneNumber, string email, int role, string rights)
        {
            PersonalCode = personalCode;
            Username = username;
            FullName = fullName;
            PhoneNumber = phoneNumber;
            Email = email;
            Role = role;
            Rights = rights;
        }

        public string Rights { get; set; }
        public bool IsPropose
        {
            get
            {
                if (Rights.Length < 6) return false;
                else
                {
                    int filter = Convert.ToInt32(Rights.Substring(0, 1));
                    if (filter == 1) return true;
                    else return false;
                }
            }
            set { }
        }
        public bool IsFilter
        {
            get
            {
                if (Rights.Length < 6) return false;
                else
                {
                    int filter = Convert.ToInt32(Rights.Substring(1, 1));
                    if (filter == 1) return true;
                    else return false;
                }
            }
            set { }
        }
        public bool IsVerify
        {
            get
            {
                if (Rights.Length < 6) return false;
                else
                {
                    int filter = Convert.ToInt32(Rights.Substring(2, 1));
                    if (filter == 1) return true;
                    else return false;
                }
            }
            set { }
        }
        public bool IsApprove
        {
            get
            {
                if (Rights.Length < 6) return false;
                else
                {
                    int filter = Convert.ToInt32(Rights.Substring(3, 1));
                    if (filter == 1) return true;
                    else return false;
                }
            }
            set { }
        }
        public bool IsPayment
        {
            get
            {
                if (Rights.Length < 6) return false;
                else
                {
                    int filter = Convert.ToInt32(Rights.Substring(4, 1));
                    if (filter == 1) return true;
                    else return false;
                }
            }
            set { }
        }
        public bool IsAdmin
        {
            get
            {
                if (Rights.Length < 6) return false;
                else
                {
                    int filter = Convert.ToInt32(Rights.Substring(5, 1));
                    if (filter == 1) return true;
                    else return false;
                }
            }
            set { }
        }
    }
}